﻿Imports System.Data.OleDb

Public Class MyTutorProfile
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Request.Params("TutorUserName") = User.Identity.Name Then
            btn_EditProfile.Visible = True
        Else
            btn_EditProfile.Visible = False
        End If
        'if page is reached from elsewhere, do the following
        If IsPostBack = False Then
            If Request.Params("TutorUserName") = "" Then Response.Redirect("MyTutorProfile.aspx?TutorUserName=" & User.Identity.Name)
            Dim oleDbConn As New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("TutorsConnectionString").ConnectionString)
            Dim SqlString As String = "SELECT * FROM qryTutorComments WHERE TutorUserName=@f1"
            Dim cmd As OleDbCommand = New OleDbCommand(SqlString, oleDbConn)
            cmd.CommandType = CommandType.Text
            cmd.Parameters.AddWithValue("@f1", Request.Params("TutorUserName"))
            oleDbConn.Open()
            Dim dr = cmd.ExecuteReader()
            GridView1.DataSource = dr
            GridView1.DataBind()
            oleDbConn.Close()
            dr.Close()
        End If
    End Sub



End Class